home *** CD-ROM | disk | FTP | other *** search
- Path: rahul.net!a2i!news
- From: terris@rahul.net (Terris Linenbach)
- Newsgroups: comp.lang.c++
- Subject: Serious trouble with STL and NT/Win95
- Date: 14 Feb 1996 05:29:18 GMT
- Organization: a2i network
- Message-ID: <4frrve$pnr@hustle.rahul.net>
- NNTP-Posting-Host: 534.rahul.net
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-Newsreader: WinVN 0.99.6
-
- The following applies to HP's STL implementation, including the version
- shipped in Microsoft Visual C++ 4.0. Credit goes to David
- Williams.
-
- 1. It is not thread-safe. Do not attempt to perform
- something on the same "type" of container in two different threads
- at the same time. (You are in trouble even if you try to do this with
- _different_ objects -- notice I said "type" and not "object")
-
- By "type", I mean a particular instantiation, such as
- vector< int >
-
- This is because most STL classes have statics in them that are not
- accessed in a thread-safe manner.
-
- 2. Do not pass *most* STL containers across DLL/EXE boundaries. Vectors
- are OK.
-
- This is because most STL classes have statics. In 32-bit
- Windows, DLLs and EXEs get their own copies of the statics. This
- causes problems.
-
- Vectors are not affected because vectors only have a static allocator,
- which doesn't have any data or any virtual member functions.
-
- If you try something like passing a set to a function in a
- DLL, your program will crash.
-
-